#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

#define MAX_SIZE 100

class Solution {
public:
  string longestPalindromeDP(string s) {
    size_t size = s.length();
    bool p[MAX_SIZE][MAX_SIZE] = { false };
    int maxLen = 1, startIndex = 0;

    for (int i = 0; i < size; ++i) {
      p[i][i] = true;
    }

    for (int i = 0; i < size - 1; ++i) {
      if (s[i] == s[i+1]) {
        p[i][i+1] = true;
        startIndex = i;
        maxLen = 2;
      }
    }

    for (int len = 3; len <= size; ++len) {
      for (int i = 0; i < size - len + 1; ++i) {
        int j = i + len - 1;
        if (p[i+1][j-1] && s[i] == s[j]) {
          p[i][j] = true;
          startIndex = i;
          maxLen = len;
        }
      }
    }

    return s.substr(startIndex, maxLen);
  }
};

int main()
{
  Solution solution;
  string str;
  cin >> str;

  string ret = solution.longestPalindromeDP(str);

  printf("Longest palindromic substring: %s\n",
         ret.length() == 0 ? "None" : ret.c_str());

  return 0;
}
